This is v1.1 of a data file class which gives TCL support for text files à la Pascal's TEXT files. But since it is a CDataFile subclass, the file behaves like a Mac file. Check out the new Demos!
For simplicity, only String reading is supported. However, the Pascal ReadString/StringOf procedures can be used to fully impliment the ReadLn/WriteLn procedures. Each file can be open for either input or output at any one time. Reads are buffered in a 512-byte buffer in the object. This buffer's size is customizable. The reads try to impliment all the standard Pascal TEXT behavior, including the obscure behavior if the file ends with something other than an EOL char.
This class is shareware. If you write a program that brings you much joy, please send me either a postcard or EMail sharing that joy. If you use it to write a distributed program (shareware, freeware, commercial), please send me a copy /w documentation (electronically is cool).
If this last requirement troubles you (such as the program you write works with proprietary data and/or is written under contract), send me a postcard (or EMail) to encourage future work, and give some money to a non-political charity. Come on, don't be too cheep. Oh, I mean charities like: UNICEF, Am. Cancer Soc., Am. Diabeties Assoc., United Negro College Fund, politically-nonactive religeous mission funds, etc.
Claris the Dogcow, whose sig is in the .sig sample, is inspiration to many programmers at Apple and elsewhere. No guaranty made as to if the sample sig's address works or reaches Claris the Dogcow.
Please report any bugs, comments, or suggestions. :)
Enjoy!
William Studenmund
wrstuden@leland.stanford.edu
Applied Physics Department
Ginzton Lab
Stanford CA 94305
Changes since v1.0:
• No known bugs, so none fixed.
• Bundled three sample programs demonstrating some ways to use the class.
The demos are:
SigAdder : appends one text file to another. Provides the functionality of adding
a .sig to UNIX EMail. Simplest example.
Segmenter: takes a text file and breaks it up by line into chunks just over 32000
chars. long. Useful for breaking a BinHex-ed file into 32K pieces for mailing
over Applelink or C.S.M.B.
Transposer: reads a two column matrix of ASCII numbers from one file, and
writes the transpose of the matrix to another file. Shows off how to read
and write reals from/to text files. Sample source matrix files saved in:
MatLab /ASCII format
Excel Text format (Tab seperators)
Excel CVS format
All demos are working programs, not code snippets. They are written procedurally
since they were written over a weekend and just want to show off the CTextFile
class. Projects w/o objects included. The .rsrc files for each one are copies of